package com.huiyou.adminapi.repository;

import com.huiyou.adminapi.common.model.PseudoCode;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Optional;

@Repository
public interface PseudoCodeRepository extends JpaRepository<PseudoCode, String> {

    Page<PseudoCode> findByGoodsNameContainingAndGoodsBatchContainingOrderByCreateTimeDesc
        (String goodsName, String goodsBatch, Pageable pageable);

    Optional<PseudoCode> findBySecurityCodeNumber(String securityId);

    Page<PseudoCode> findByGoodsNameContainingAndGoodsBatchContainingOrderByGoodsNumber
        (String goodsName, String goodsBatch, Pageable pageable);

    void deleteByGoodsNameAndGoodsBatch(String goodsName, String goodsBatch);

    Page<PseudoCode> findByGoodsBatchAndGoodsName(String batch, String name,Pageable pageable);
}